package com.tao.YanMoDesignPattern.composite.case2_parent;

/**
 * @Author Mi_Tao
 * @Date 2023/8/27
 * @Description
 * @Version 1.0
 **/
public class Leaf extends Component {

    // 叶子对象的名字
    private String name;

    public Leaf(String name) {
        this.name = name;
    }

    // 打印出叶子结点的名字
    @Override
    public void printStruct(String preStr) {
        System.out.println(preStr + "+" + name);
    }

}
